package com.reins.bookstore.entity;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import com.reins.bookstore.object.UserDTO;
import lombok.Data;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;

@Data
@Entity
@Table(name = "user")
@JsonIgnoreProperties(value = { "handler", "hibernateLazyInitializer", "fieldHandler" })
public class User {

    @Id
    private int userId;
    private String nickname;
    private String email;
    private String address;

    public User(UserDTO user_dto){
        this.userId = user_dto.getUserId();
        this.nickname = user_dto.getNickname();
        this.email = user_dto.getEmail();
        this.address = user_dto.getAddress();
    }

    public User(UserDTO user_dto,UserAuth userAuth){
        this.userId = userAuth.getUserId();
        this.nickname = user_dto.getNickname();
        this.email = user_dto.getEmail();
        this.address = user_dto.getAddress();
    }

    public User() {
    }
}
